# coding:utf-8

import urllib2
import cookielib
from bs4 import BeautifulSoup

def UseCookie():
    cookie = cookielib.CookieJar()
    handler = urllib2.HTTPCookieProcessor(cookie)
    opener = urllib2.build_opener(handler)
    response = opener.open('http://www.baidu.com')
    for item in cookie:
        print(item)

if __name__ == '__main__':
    UseCookie()